package com.chen.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Slf4j
//@Aspect
@Component
public class RecordTimeAspect {
    @Around("execution(* com.chen.service.Impl.*.*(..))")
    public Object recordTime(ProceedingJoinPoint pjp) throws Throwable {
        long start = System.currentTimeMillis();
        Object Result =pjp.proceed();
        long end = System.currentTimeMillis();
        log.info("方法{}执行耗时：{}ms", pjp.getSignature(),end - start);
        return Result;

    }
}
